import React, { useEffect } from 'react'
import { Card } from 'antd-mobile'
import { observer, inject } from 'mobx-react';
import { useNavigate } from 'react-router-dom'
import style from './index.module.css';

const Home = (props) => {
	const { appStore } = props
	const { setIsLoginPage } = appStore
	const navigate = useNavigate()
  
	useEffect(() => {
		if (!sessionStorage.getItem('user')) {
			navigate('/login')
			setIsLoginPage(true)
		} else {
			setIsLoginPage(false)
		}
	}, [])

	return (
		<div>
			<Card className={style.card}>
				首页
			</Card>
		</div>
	)
}

const HomeWrap = inject((stores) => {
	return {
		appStore: stores.appStore
	}
})(observer(Home))

export default HomeWrap
